package com.cskaoyan.until;


import com.cskaoyan.bean.User;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;

/**
 * @description：
 * @author: 曹旭
 * @date: 2022/5/10 07:13
 */
public class CurrentUserUtil {
    public static Integer getId() {
        Subject subject = SecurityUtils.getSubject();
        if (subject.getPrincipals() == null) {
            return null;
        }
        Integer userId = (Integer) subject.getPrincipals().getPrimaryPrincipal();
        return userId;
    }
}
